/*
 ============================================================================
 Page	     : 96
 Name        : varwid.c
 Date	     : 20210403
 Author      : Hbue 18060333
 Copyright   : Your copyright notice
 Description : 使用变宽输出字段
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	unsigned width = 0;
	unsigned precision = 0;
	int number = 256;
	double weight = 242.5;

	printf("Enter a field width:\n");
	scanf("%d",&width);
	printf("The number is :%*d:\n", width, number);
	printf("Now enter a width and a precision:\n");
	scanf("%d %d", &width, &precision);
	printf("Weight = %*.*f\n", width, precision, weight);
	printf("Done!\n");

	return EXIT_SUCCESS;
}

